/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.con.impl;

import de.sabram.upb.specs.con.ALT;
import de.sabram.upb.specs.con.ConPackage;
import de.sabram.upb.specs.con.ElemList;
import de.sabram.upb.specs.con.TerminalOrLiteral;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>ALT</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.con.impl.ALTImpl#getTerminalOrLiteral <em>Terminal Or Literal</em>}</li>
 *   <li>{@link de.sabram.upb.specs.con.impl.ALTImpl#getElementList <em>Element List</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ALTImpl extends RHSImpl implements ALT
{
  /**
   * The cached value of the '{@link #getTerminalOrLiteral() <em>Terminal Or Literal</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTerminalOrLiteral()
   * @generated
   * @ordered
   */
  protected EList<TerminalOrLiteral> terminalOrLiteral;

  /**
   * The cached value of the '{@link #getElementList() <em>Element List</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getElementList()
   * @generated
   * @ordered
   */
  protected EList<ElemList> elementList;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ALTImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ConPackage.Literals.ALT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<TerminalOrLiteral> getTerminalOrLiteral()
  {
    if (terminalOrLiteral == null)
    {
      terminalOrLiteral = new EObjectContainmentEList<TerminalOrLiteral>(TerminalOrLiteral.class, this, ConPackage.ALT__TERMINAL_OR_LITERAL);
    }
    return terminalOrLiteral;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ElemList> getElementList()
  {
    if (elementList == null)
    {
      elementList = new EObjectContainmentEList<ElemList>(ElemList.class, this, ConPackage.ALT__ELEMENT_LIST);
    }
    return elementList;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ConPackage.ALT__TERMINAL_OR_LITERAL:
        return ((InternalEList<?>)getTerminalOrLiteral()).basicRemove(otherEnd, msgs);
      case ConPackage.ALT__ELEMENT_LIST:
        return ((InternalEList<?>)getElementList()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ConPackage.ALT__TERMINAL_OR_LITERAL:
        return getTerminalOrLiteral();
      case ConPackage.ALT__ELEMENT_LIST:
        return getElementList();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ConPackage.ALT__TERMINAL_OR_LITERAL:
        getTerminalOrLiteral().clear();
        getTerminalOrLiteral().addAll((Collection<? extends TerminalOrLiteral>)newValue);
        return;
      case ConPackage.ALT__ELEMENT_LIST:
        getElementList().clear();
        getElementList().addAll((Collection<? extends ElemList>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ConPackage.ALT__TERMINAL_OR_LITERAL:
        getTerminalOrLiteral().clear();
        return;
      case ConPackage.ALT__ELEMENT_LIST:
        getElementList().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ConPackage.ALT__TERMINAL_OR_LITERAL:
        return terminalOrLiteral != null && !terminalOrLiteral.isEmpty();
      case ConPackage.ALT__ELEMENT_LIST:
        return elementList != null && !elementList.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ALTImpl
